Skip to content

fix(i18n): resolve translation warnings in make-pot - #4323

Merged
felipeelia merged 3 commits into
10up:developfrom
faisalahammad:fix/4313-translation-warnings
Jul 23, 2026
Merged

fix(i18n): resolve translation warnings in make-pot#4323
felipeelia merged 3 commits into
10up:developfrom
faisalahammad:fix/4313-translation-warnings

Conversation

@faisalahammad

@faisalahammad faisalahammad commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Running wp i18n make-pot produced two warnings in the JS files: one duplicate translator comment on the string %1$s and %2$s and one missing translator comment on Page %d. This change unifies the comments and adds the missing ones so the POT file builds cleanly.

Fixes #4313

Changes

assets/js/features/components/control.js

Before:

/* translators: %1$s: first feature name, %2$s: second feature name */
__('%1$s and %2$s', 'elasticpress'),
// ...
/* translators: %1$s: comma-separated list of feature names, %2$s: last feature name */
__('%1$s and %2$s', 'elasticpress'),

After:

/* translators: %1$s: feature name(s), %2$s: last feature name */
__('%1$s and %2$s', 'elasticpress'),
// ...
/* translators: %1$s: feature name(s), %2$s: last feature name */
__('%1$s and %2$s', 'elasticpress'),

Why: The same string literal had two different translator comments, which triggers a make-pot warning. A single comment describing both placeholders works for both call sites.

assets/js/instant-results/components/results/pagination.js

Before:

aria-label={sprintf(__('Page %d', 'elasticpress'), page.value)}

After:

/* translators: %d: Page number. */
aria-label={sprintf(__('Page %d', 'elasticpress'), page.value)}

Why: %d needs a translator comment to explain it is the page number.

assets/js/synonyms/apps/synonyms-settings.js

Before:

/* translators: Synonyms count */
sprintf(__('Synonyms (%d)', 'elasticpress'), synonyms.length)

After:

/* translators: %d: Number of synonyms. */
sprintf(__('Synonyms (%d)', 'elasticpress'), synonyms.length)

Why: The %d placeholder is clearer for translators when the comment references it directly. Same change applied to hyponyms and replacements tabs.

Testing

Test 1: Generate POT file

  1. Go to the plugin folder.
  2. Run wp i18n make-pot . lang/elasticpress.pot.

Result: No warnings. POT file builds successfully.

Screenshots

Before:
SCR-20260619-ttck

After:
image

- Unify translator comments for %1 and %2 in feature control.js
- Add translator comment for Page %d in pagination.js
- Improve translator comments for %d placeholders in synonyms settings

Fixes 10up#4313
Comment thread assets/js/features/components/control.js Outdated
Comment thread assets/js/features/components/control.js Outdated
Replace __() with _x() to resolve make-pot duplicate comment warning.
Same translator comment on both calls, distinct disambiguation contexts
for the two call sites.

Addresses PR review feedback.

Refs 10up#4323
@faisalahammad

Copy link
Copy Markdown
Contributor Author

@burhandodhy Addressed both review threads:

  • Replaced __() with _x() using context 'two feature names' and 'multiple feature names' for disambiguation
  • Same translator comment on both calls to avoid make-pot duplicate warning
  • npm run lint-js passes clean
  • wp i18n make-pot produces no warnings
  • CodeRabbit passed

Ready for re-review.

@felipeelia felipeelia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @faisalahammad! We will just need some minor adjustments before we merge this one. We are almost there, thanks for your patience!

Comment thread assets/js/features/components/control.js Outdated
Comment thread assets/js/features/components/control.js Outdated
- Two-names branch: %1$s is a single feature name
- Multiple-names branch: %1$s is a list of feature names

Addresses PR feedback.

Refs 10up#4323
@felipeelia felipeelia added this to the 5.3.4 milestone Jul 23, 2026
@felipeelia
felipeelia merged commit 4845c81 into 10up:develop Jul 23, 2026
23 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Fix translation warnings

3 participants